﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var uname = TextBox1.Text;
            var password = TextBox2.Text;
            var dt = Dbhelper.GetData(string.Format("select * from users where username='{0}' and password='{1}'",uname,password));
            if (dt.Rows.Count == 1)
            {
                Label3.Text = "登录成功";
                Response.Redirect("Default.aspx");
            }
            else
            {
                Label3.Text = "登录失败";
            }
        }
    }
}